package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.cms.service.ModulesAdvertiseService;
import com.junzhiit.nengji.cms.web.vo.AdvertiseAddVO;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/modules/advertise")
public class ModulesAdvertiseController extends BaseController {

	@Autowired
	private ModulesAdvertiseService modulesAdvertiseService;

	@ApiOperation(value = "获取所有用户列表")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> findAll(DataTablesParamVO dtp, String modulesId) {
		AssertUtil.notBlank(modulesId, "modulesId is required.");
		return modulesAdvertiseService.findAll(dtp, modulesId);
	}

	@RequestMapping(method = RequestMethod.POST)
	public ResultVO add(AdvertiseAddVO advertiseAddVO, String modulesId) {
		return modulesAdvertiseService.add(advertiseAddVO, modulesId);
	}

	@RequestMapping(value = "del", method = RequestMethod.PUT)
	public ResultVO del(String modulesAdvertiseId) {
		return modulesAdvertiseService.del(modulesAdvertiseId);
	}
}
